﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Reflection;
using System.Windows.Forms;

namespace AimGameEngine.NodeEditorObject
{
    partial class PropretyInt : Form
    {
        NodeInt nodeint;
        public PropretyInt(NodeInt nodeint)
        {
            InitializeComponent();

            this.nodeint = nodeint;
            this.numValue.Value = nodeint.myint;
            this.InputMode.SelectedItem = nodeint.InputMode.ToString();
        }

        private void okButton_Click(object sender, EventArgs e)
        {
            String tempString = (String)this.InputMode.SelectedItem;
            String tempOldmode = nodeint.InputMode.ToString();

            if (tempString == AimGameLibrary.NodeInputMode.Int_1.ToString())
                this.nodeint.InputMode = AimGameLibrary.NodeInputMode.Int_1;
            else
            {
                this.nodeint.myint = (int)numValue.Value;
                this.nodeint.InputMode = AimGameLibrary.NodeInputMode.None;
            }

            if (tempOldmode != tempString)
            nodeint.SetupProprety();
        }

        private void InputMode_SelectedIndexChanged(object sender, EventArgs e)
        {
            String tempString = (String)this.InputMode.SelectedItem;

            if (tempString == AimGameLibrary.NodeInputMode.Int_1.ToString())
                numValue.Enabled = false;
            else numValue.Enabled = true;
        }

    }
}
